package models

import (
	"ginstudydemo.com/main/dao"
	"time"
)

// AddFileMate 新增上传文件信息
func AddFileMate(insertData SysFileMateAddData) (SysFileMateAddData, error) {

	//==>  Preparing: INSERT INTO sys_role ( name, code, sort, status, data_scope, create_time, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ? )
	//==> Parameters: 管理员21(String), ADMIN21(String), 1(Integer), 1(Integer), 1(Integer), 2024-10-11T19:32:07.863432(LocalDateTime), 2024-10-11T19:32:07.863464(LocalDateTime)

	//var insertData SysRoleAddData
	//cpErr := copier.Copy(&insertData, &fileData)
	//if cpErr != nil {
	//	return insertData.ID, cpErr
	//}
	//
	//insertData.CreateTime = time.Now()
	insertData.UploadTime = time.Now()

	//Create参数需要传入一个指针，所有形参user定义为结构体指针类型
	err := dao.Db.Table("sys_file_meta").Create(&insertData).Error // 通过数据的指针来创建
	return insertData, err
}
